<template>
  <div class="recommend">
    <p>商品推荐</p>
    <ul>
      <li v-for="item of recommend" :key="item.goodsId">
        <!-- <router-link :to="{name:'detail',params:{id:item.goodsId}}"> -->
        <img v-lazy="item.image" @click="showGoods(item.goodsId)">
        <p>{{item.goodsName}}</p>
        <p>{{item.price | rmb}}(￥{{item.mallPrice | rmb}})</p>
        <!-- </router-link> -->
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: ["recommend"],
  filters: {
    rmb(value) {
      return "￥" + value;
    }
  },
  methods: {
    showGoods(id) {
      // console.log(this)
      this.$parent.$parent.getDetail(id);
    }
  }
};
</script>

<style lang="scss" scoped>
.recommend {
  width: 100%;
  background-color: white;
  & > p {
    color: #e71989;
    font-size: 12px;
    padding: 3px;
    border-bottom: 1px solid #eeeeee;
  }
  ul {
    width: 100%;
    display: flex;
    text-align: center;
    overflow: auto;
    li {
      width: 125px;
      line-height: 20px;
      border-right: 1px solid #eeeeee;
      img {
        width: 125px;
        height: 100px;
      }
      p {
        font-size: 12px;
      }
    }
  }
}
</style>